<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class AnswerController extends Controller
{
    public function getIndex(Request $request){
       
        $date=DB::table('issue')
            ->leftJoin('topic','topic.id','=','issue.tid')
            ->select('issue.*','topic.title')
            ->get();
        // dd($date);
            // 获取传值
            $res=$request->input('ht');
            // dd($res);
            if($res){
            $data=DB::table('topic')
                ->join('issue','issue.tid','=','topic.id')
                ->join('userDetails','userDetails.uid','=','issue.uid')
                ->where('title','like','%'.$res.'%')
                ->orwhere( 'atitle','like','%'.$res.'%')
                ->get();
                // dd($data);
           
                return view('/home/answer/answer',['data'=>$data],['date'=>$date]);
            }else{
                return view('/home/answer/answer',['date'=>$date]);

            }
        
        
      
    }

  
}
